Easy to Create, Easy to Change - Easy to use!

Command::

query selection



Parameters


Returns/Result


Examples


Reference

query selection

Type

Processing Command

Purpose

The query selection command is functional only on a LAN (local area network). This command is used to override DataEase's default locking rules. It should only be used by a technical expert who is very familiar both with DataEase and the LAN environment in use. If you do not have expertise in LANs, you can rely on the default locking rules to lock your data appropriately.

Before DataEase begins processing records for a script, it must select the records to be processed. The query selection command tells DataEase how to set locks prior to the start of processing if records are being selected or sorted on an indexed field. If records are not being selected or sorted on an indexed field, the default locking rules apply.

Syntax

query selection lock files|records|nothing .

The three syntax options that are used in conjunction with the query selection command are explained below.

The query selection lock files command overrides the default Record Selection locking rules and locks the table(s) from which records are being selected. Other users cannot add, modify, or delete records in the table. They can view records in the table if the selected records will only be listed by the procedure (not modified or deleted). The table remains locked until the end of the procedure.

The query selection lock records command overrides the default Record Selection locking rules and locks any records that have been selected for processing. Other users cannot modify or delete these records. They can view the records if the selected records will only be listed by the procedure (not modified or deleted). Other users can view, modify, or delete records in the same table(s) that have not been selected. Once processing begins, the default locking rule applies.

The query selection lock nothing command overrides the default Record Selection locking rules and unlocks the table(s) from which records are being selected. Other users can view, modify, or delete records that have been selected for processing. Once processing begins, the default locking rule applies.

The lock nothing command can be useful in situations where you need to keep data available to many users even while running a procedure that uses that data. However, with this command in effect, it is possible for a user to change a record that has already been selected for processing.

 

Caution

The query selection lock records command should be used with great care. It should only be used for procedures that select very few records from very few tables. If this command is used for many records, most LANs cannot support the number of locks required. If this command is used incorrectly, the integrity of your data can be compromised.

 

Note: If a lock all files command occurs as the first command in a script, it overrides the default locking rules and any locking commands specified later in the script. A lock all files command locks all files used by the procedure until an unlock command is encountered or the procedure ends, regardless of subsequent commands. See the lock command earlier in this chapter for more information.

Usage

The query selection command overrides the LAN default Record Selection locking rules assigned by the database administrator. A query selection command is automatically terminated at the end of a script.

When using lock records on a DOS network, we recommend that you process a small number of records. Otherwise, your network may run out of locks and cause your workstation (or the network server) to lock up and require rebooting.

 

Example

 query selection lock nothing .

 for MEMBERS with BONUS POINTS > 500 ;

  modify records

  TOTAL DUE := ( TOTAL DUE * data-entry DISCOUNT ) .

 end

 

This script tells DataEase: (1) Override the default Record Selection locking rule so other users can view, add, delete, or modify the data in the MEMBERS table while records are selected to be processed by this procedure, (2) select all the MEMBERS records whose BONUS POINTS are greater than 500, and (3)modify each selected record by multiplying the TOTAL DUE amount by the value in the DISCOUNT field on the Data-entry form.

In this example many records may be selected to be processed. However, users can still access the MEMBERS table while the procedure is processing. It is unlikely that any member's BONUS POINTS will fall below 500 while the script is being processed.

See Also


On the forum about query selection

On the blog about query selection